package com.gzhu.knowledgeAdmin.common.run;

import com.gzhu.knowledgeAdmin.service.ZsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author yangminggui
 * @create 2024-05-03 21:25
 */

@Component
public class ESCommandLineRunner implements CommandLineRunner {
    @Autowired
    ZsService zsService;
    @Override
    public void run(String... args) throws Exception {

        try {
            zsService.importAllToES();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("未能同步知识库数据到ES中！！！！！！！，知识检索功能用不了");
        }

        // 还可以处理命令行参数
        for (String arg : args) {
            System.out.println("********************Received command-line argument: " + arg);
        }
    }
}

